from typing import *

from bisect import bisect_left


class Solution:

    def maximizeTheProfit(self, n: int, offers: List[List[int]]) -> int:
        offers.sort(key=lambda a: a[1])
        f = [[-1, 0]]
        ans = -1
        for s, e, g in offers:
            i = bisect_left(f, s, key=lambda a: a[0]) - 1
            cg = max(f[i][1] + g, f[-1][1])
            if f[-1][0] == e:
                f[-1][1] = max(f[-1][1], cg)
            else:
                f.append([e, cg])
            ans = max(ans, f[-1][1])
        return ans


s = Solution()
print(
    s.maximizeTheProfit(4,
                        [[0, 0, 6], [1, 2, 8], [0, 3, 7], [2, 2, 5], [0, 1, 5],
                         [2, 3, 2], [0, 2, 8], [2, 3, 10], [0, 3, 2]]))

a = 593.65
b = 896.32
print((b - a) / a)